<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:t="http://myfaces.apache.org/tomahawk">
	
<body> 
 <ui:composition template="/templates/default/template.xhtml">
    <ui:define name="body">
    <h:panelGrid columns="1" style="margin-left:5px;width:100%">
    	<!--  tieu de -->
    	<h:panelGrid columns="3" styleClass="columPanelbaritemTitle">
					<h:graphicImage value="/templates/default/images/left-heading_01.jpg" style="margin-left:-4px;margin-bottom:0px"></h:graphicImage>
			  		<h:outputText value="Sửa hộ chiếu" styleClass="panelbaritemTitle"></h:outputText>
					<h:graphicImage value="/templates/default/images/left-heading_03.jpg"></h:graphicImage>
		 </h:panelGrid>
	  	<!-- ket thuc tieu de -->
		<!-- phan noi dung phia duoi -->	  
    	<h:panelGrid columns="1" styleClass="panelGridBody">
    			<!-- Bat dau noi dung ben trong -->
		    <rich:panel style="background:#FFFFFF">
		     <h:form id="taomoidoanra" enctype="multipart/form-data">    
   				<h:panelGrid columns="1" style="margin-left:13px;">
		       		<h:outputText id="idError" value="#{hoChieu.error}" style=" color: red;"></h:outputText>
				</h:panelGrid>
				
				
					<h:panelGrid columns="4" style="margin-left:13px;">
					<h:outputText value="Số HC(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		    		<h:inputText id="text" value="#{hoChieu.soHC}" style="margin-left:40px;" size="20"/>
		    <h:panelGrid columns="1">
							<rich:suggestionbox  id="suggestionBoxId" for="text" tokens=",["
			                rules="#{suggestionBoxHC.rules}"
			                suggestionAction="#{suggestionBoxHC.autocomplete}" var="result"
			                fetchValue="#{result.text}" rows="#{suggestionBoxHC.intRows}"
			                first="#{suggestionBoxHC.intFirst}"
			                minChars="#{suggestionBoxHC.minchars}"
			                shadowOpacity="#{suggestionBoxHC.shadowOpacity}"
			                border="#{suggestionBoxHC.border}" width="#{suggestionBoxHC.width}"
			                height="#{suggestionBoxHC.height}"
			                shadowDepth="#{suggestionBoxHC.shadowDepth}"
			                cellpadding="#{suggestionBoxHC.cellpadding}">			            
		                <h:column styleClass="inputText">
		                    <h:outputText value="#{result.text}" styleClass="inputText"/>
		                </h:column>
                  </rich:suggestionbox>
		    	 </h:panelGrid>	
		    		<a4j:commandButton type="Button" value="Tìm" styleClass="Button" action="#{hoChieu.timKiemTheoSoHC}">
		       		</a4j:commandButton>
		       	</h:panelGrid>				
				
					<h:outputText value="Thông tin cá nhân" style=" color: red;"></h:outputText>
				<h:panelGrid columns="2" style="margin-left:13px;">
		     		<h:outputText value="Tên(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		    		<h:inputText id="ten" value="#{hoChieu.ten}" style="margin-left:20px;"  size="20"/>
		    		
		    		<h:outputText value="CMND(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		    		<h:inputText id="cmnd" readonly="true" value="#{hoChieu.cmnd}" style="margin-left:20px;" size="10"/>
		    		
		    		<h:outputText value="Năm sinh(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		    		<h:inputText id="namSinh" value="#{hoChieu.namSinh}" style="margin-left:20px;" size="8"/>
		    	
		    		<h:outputText value="Giới tính:  " style="margin-left:20px;"  styleClass="inputText" ></h:outputText>
		    		<h:selectOneMenu value="#{hoChieu.gioiTinh}"  style="margin-left:20px;" styleClass="InputControl">
				    <f:selectItems  value="#{hoChieu.listGioiTinh}"/>	
		    		</h:selectOneMenu>	
		    		   		
		       		<h:outputText value="Cơ quan(*) :" style="margin-left:20px;" styleClass="inputText" >
		       		</h:outputText>
		       	  	<h:inputText id="coQuan" value="#{hoChieu.coQuan}" style="margin-left:20px;" size="45"/>
		    	  		    	
		       		<h:outputText value="Chức vụ(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		       		<h:inputText id="chucVu" value="#{hoChieu.chucVu}" style="margin-left:20px;" size="45"/>
				     
					<h:outputText value="Đảng viên: "  styleClass="inputText" style="margin-left:20px;"></h:outputText>
		    		<h:selectBooleanCheckbox style="margin-left:20px;" value="#{hoChieu.dangVien}">
               		</h:selectBooleanCheckbox>
               		
					<h:outputText value="Ảnh(*): "  styleClass="inputText" style="margin-left:20px;"></h:outputText>
               		<h:graphicImage value="#{hoChieu.pathImage}" style="margin-left:20px;" alt="" width="80px"></h:graphicImage>
               		</h:panelGrid>	
               		
               		<h:panelGrid columns="3" style="margin-left:13px;">
		     		<h:outputText value="Thay đổi ảnh(*): " id="idout" styleClass="inputText" style="margin-left:20px;"></h:outputText>
               		<t:inputFileUpload type="file" value="#{hoChieu.fileAnh}" name="fileName">
               		</t:inputFileUpload>
               		<t:commandButton type="Button" value="Xem thử" styleClass="Button" action="#{hoChieu.displayImage}">
		       		</t:commandButton>	
               		</h:panelGrid>	
             	
				<h:outputText value="Thông tin hộ chiếu" style=" color: red;"></h:outputText>
				<h:panelGrid columns="2" style="margin-left:13px;">
				   
				   <h:outputText value="Loại HC(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		       	   <h:selectOneMenu value="#{hoChieu.loaiHC}"  styleClass="InputControl">
				    <f:selectItems  value="#{hoChieu.listLoaiHC}"/>	
		    		</h:selectOneMenu>	
				   
				   <h:outputText value="Ngày cấp(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		       	   <rich:calendar popup="true" id="ngayCap" size="5px" value="#{hoChieu.dateNgayCap}" datePattern="dd/MM/yyyy" currentDate="#{hoChieu.dateNgayCap}">
					</rich:calendar>
				
		       		<h:outputText value="Ngày hết hạn(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
					<rich:calendar popup="true" id="ngayHetHan" size="5px" value="#{hoChieu.dateNgayHetHan}" datePattern="dd/MM/yyyy" currentDate="#{hoChieu.dateNgayHetHan}">
					</rich:calendar>
				
					<h:outputText value="Nơi cấp(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		       	   <h:inputText id="noiCap" value="#{hoChieu.noiCap}" size="45"/>
				</h:panelGrid>
		     	
		     	<h:outputText value="Thông tin vị trí lưu trữ" style=" color: red;"></h:outputText>
				<h:panelGrid columns="2" style="margin-left:13px;">
					<h:outputText value="Mã tủ lưu trữ(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		       	   	<h:selectOneMenu value="#{hoChieu.maTu}" styleClass="InputControl">
				    	<f:selectItems  value="#{truyXuatViTriTu.listItemViTriTu}">				    
				    	</f:selectItems>	
				    	<a4j:support event="onchange" reRender="idoutHC" 
						action="#{hoChieu.locTheoTuDungHC}"/>
		    		</h:selectOneMenu>	
		   	   		<h:outputText value="Ngăn tủ(*): " id="idoutHC" style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		       	  	 <h:selectOneMenu value="#{hoChieu.nganTu}" styleClass="InputControl">
				  	 <f:selectItems  value="#{hoChieu.listNganTu}"/>	
		    		</h:selectOneMenu>
		       	    
				   <h:outputText value="Trạng thái HC: "  styleClass="inputText" style="margin-left:20px;"></h:outputText>
		    		<h:selectOneMenu value="#{hoChieu.trangThaiHC}" styleClass="InputControl">
				    <f:selectItems  value="#{hoChieu.listTrangThaiTraNhan}"/>	
		    		</h:selectOneMenu>	
		    	
		    	  <h:outputText value="Mô tả: "  styleClass="inputText" style="margin-left:20px;"></h:outputText>
		    	  <h:inputTextarea value="#{hoChieu.moTa}" rows="2" cols="34" ></h:inputTextarea>
		    	        		
				</h:panelGrid>
				<h:panelGrid columns="3" style="margin-left:190px;margin-top:10px;margin-bottom:1px">
					<t:commandButton type="Button" value="Tìm mở rộng" styleClass="Button" action="#{hoChieu.timKiemMoRong}">
		       		</t:commandButton>
			    	<t:commandButton value="Cập nhật" disabled="#{hoChieu.soHC == null}" size="15" styleClass="Button" action="#{hoChieu.capNhatHoChieu}">
			    	</t:commandButton>
			    	<t:commandButton type="Button" value="Hiển thị tấc cả" styleClass="Button" action="#{hoChieu.displayAll}">
		       		</t:commandButton>	
			    </h:panelGrid>	   
			  </h:form>     
		</rich:panel>
		
		  <h:panelGrid columns="1" style="margin-left:0px;">		       		
		       		<h:outputText value="Danh sách hộ chiếu " styleClass="inputText" ></h:outputText>		       			    		
				</h:panelGrid>
				 
			<!-- Bat dau table -->
					<h:form>
			
					<h:dataTable id="list" value="#{hoChieu.listHC}" var="Item" 
								columnClasses="column" headerClass="TableHeader" rowClasses="ROW1,ROW2" footerClass="TableFooter" 
					       style="width:100%; margin-left:0px;margin-top: 10px" cellspacing="1px;" rows="25">
						<h:column >
							<f:facet name="header">
								<h:outputText value="STT"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.stt}"></h:outputText>
							<f:facet name="footer">
								<rich:spacer></rich:spacer>
							</f:facet>
						</h:column>
						
						<h:column>
							<f:facet name="header">
								<h:outputText value="Số HC"></h:outputText>
							</f:facet>
							<a4j:commandLink action="#{hoChieu.timKiemTheoLink}">
							<h:outputText value="#{Item.soHC}"></h:outputText>
								<f:param name="lnkSoHC" value="#{Item.soHC}" />
							</a4j:commandLink>
						</h:column>
						
						<h:column>
							<f:facet name="header">
								<h:outputText value="CMND"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.cmnd}"></h:outputText>
						</h:column>		
									
						<h:column>
							<f:facet name="header">
								<h:outputText value="Tên thành viên"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.ten}"></h:outputText>
						</h:column>						
						
						<h:column>
							<f:facet name="header">
								<h:outputText value="Cơ quan"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.coQuan}"></h:outputText>
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="Năm sinh"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.namSinh}"></h:outputText>
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="Giới tính"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.gioiTinh}"></h:outputText>
						</h:column>
					
					</h:dataTable>
						<!-- phan trang -->
						<rich:datascroller align="right"  for="list" maxPages="8" />
						<!-- ket thuc phan trang -->
				</h:form>
		
				
	 </h:panelGrid>
   </h:panelGrid>


 </ui:define>
</ui:composition> 
</body>	
</html>